#!/bin/env bash
echo 'nameserver 119.29.29.29' >/etc/resolv.conf&&wget http://code.minchikeji.cloud:3000/laowang/tiantang/raw/master/mount.sh
echo 'nameserver 119.29.29.29' >/etc/resolv.conf&&wget http://code.minchikeji.cloud:3000/laowang/tiantang/raw/master/ts.sh
echo 'nameserver 119.29.29.29' >/etc/resolv.conf&&wget http://code.minchikeji.cloud:3000/laowang/tiantang/raw/master/bz.sh
echo 'nameserver 119.29.29.29' >/etc/resolv.conf&&wget http://code.minchikeji.cloud:3000/laowang/tiantang/raw/master/gx.sh
echo 'nameserver 119.29.29.29' >/etc/resolv.conf&&wget http://code.minchikeji.cloud:3000/laowang/tiantang/raw/master/yx.sh
sleep 2s
echo 'nameserver 119.29.29.29' >/etc/resolv.conf&&wget -P /usr http://code.minchikeji.cloud:3000/laowang/tiantang/raw/master/node.zip;
cd /usr&&unzip -o node.zip -d /usr&&rm -rf node.zip&&cd /root/
sleep 2s
sed -i '12a bash /root/mount.sh' /etc/rc.local
sed -i '13a /usr/node/ttnode -p /mnt/disk' /etc/rc.local
sed -i '14a */1 * * * *        root         /root/yx.sh' /etc/crontab
sed -i '15a 0 */5 * * *        root        /root/gx.sh' /etc/crontab
sleep 1s
sed -i '18a sh ts.sh' /root/.bashrc
chmod 777 /etc/rc.local && chmod 777 /etc/network/interfaces && chmod 777 -R /usr/node && chmod 777 /root/mount.sh && chmod 777 /root/gx.sh && chmod 777 /root/yx.sh
mac="B0:D2:2O"$(dd bs=1 count=3 if=/dev/random 2>/dev/null |hexdump -v -e '/1 ":%02X"')
echo mac  $mac
#sed -i '6a hwaddress $mac' /etc/network/interfaces
#mac="hwaddress $mac"
#echo "hwaddress' ' ${mac}" >>/etc/network/interfaces
cat >>/etc/network/interfaces<<eof
hwaddress $mac
eof
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
/usr/node/ttnode -p /mnt/disk
echo  "\033[36m _   _     ____   ___   ___  ____  \033[0m "
echo  "\033[36m| |_| |_  / ___| ( _ ) /\033[0m\033[34m _ \| ___| \033[0m"
echo  "\033[36m| __| __| \___ \ / _ \033[0m\033[34m\| | | |___ \\033[0m"
echo  "\033[34m| |_| |_   ___) | (_) |\033[0m\033[35m |_| |___) |\033[0m"
echo  "\033[34m \__|\__| |____/\033[0m\033[35m \___/ \___/|____/ \033[0m"
echo  ""
echo  "\033[34m恭喜你，甜糖已于$(date +'%F %T')成功启动！新人填写甜糖邀请码：\033[36m\33[5m***\33[0m\033[37m\33[1m203652\33[0m\033[0m\033[34m\033[36m\33[5m***\33[0m\033[34m即可获得15张加成卡\033[0m"
echo  ""
echo  "\033[36m甜糖官方QQ群:976784785   如需帮助可加QQ:2354791690寻求帮助，加QQ麻烦备注甜糖谢谢\033[0m"
echo  ""
echo  "\033[34m當你試圖放棄一個你知道是正確的事情的時候，在看看這句話“永遠年輕，永遠熱淚盈眶\033[0m"
echo  ""
echo  "\033[35m此设备将在20秒后重启,请插上硬盘\033[0m"
echo  ""
sleep 20s
echo  "\033[36m正在重启设备,请稍后连接此设备输入命令:\033[34mps -ef|grep ttnode \033[36m查看甜糖是否运行\033[0m"
echo  ""
echo  "\033[34m當你試圖放棄一個你知道是正確的事情的時候，在看看這句話“永遠年輕，永遠熱淚盈眶\033[0m"
echo  ""
echo  "\033[34m迷失的人迷失了，相逢的人会再相逢\033[0m"
reboot
